define(['../module'], function (module) {
  'use strict';
  module.controller('SaleOrderMainCtrl', function ($scope, Common, $state, $resource ,PageData) {
    PageData.title = "销售订单";
    PageData.titleDes = "";
    var resource = $resource(
      'http://....',
      {
        callback: "JSON_CALLBACK"
      },{
        query: {
          method: "JSONP",
          isArray: true
        }
      }
    );
    resource.query(function(records){
      console.log(records);
    })




    var model;
    model = Common('sale/order');
    model.query(function (records) {
      return $scope.orders = records;
    });
    $scope.toggle = function (orders) {
      var i, len, order;
      for (i = 0, len = orders.length; i < len; i++) {
        order = orders[i];
        order.ck = !order.ck;
      }
    };
    $scope.select = function (id) {
      return model.get({
        id: id
      }, function (data) {
        return $scope.item = data;
      });
    };

  });
});
